/***************************************/
/** This do-file performs the       ****/
/** the IV analysis for 		 ***/
/** Elections in dictatorships		  **/
/***************************************/

use "ReplicationData.dta", replace



sort gwno year
xtset gwno year

************************************************************
****Table 3 (plus first stage results in appx table A.21****
************************************************************

ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election = nbmean_dictatorelection), first 
estimates store iv1
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection1  = nbmean_dictatorelection), first
estimates store iv2
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first 
estimates store iv3
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection1  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first
estimates store iv4
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first 
estimates store iv5
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection1  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first
estimates store iv6
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election = nbmean_dictatorelection globmeandictatorelection), first 
estimates store iv7
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection1  = nbmean_dictatorelection globmeandictatorelection), first
estimates store iv8
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election = nbmean_dictatorelection globmeandictatorelection), first 
estimates store iv9
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection1  = nbmean_dictatorelection globmeandictatorelection), first
estimates store iv10
estout iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10, cells(b(star fmt(%9.3f)) se(par fmt(%9.2f))) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N)style (tex)

*** Note: For some reason (maybe copy-editing) the election year coefficient in Model 3 should be  1.897 and not  1.898 as reported in the paper.
***For test statistics Table 3 and A.21, see 2SLS models also reported in Table A.23 further below


********************************************************
****Table A.20 (second-stage) and A.22 (first-stage)****
********************************************************
ivprobit gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election5year = nbdictatorelection5year), first 
estimates store iv1
ivprobit gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection8  = nbdictatorelection5year), first
estimates store iv2
ivprobit gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election5year = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first 
estimates store iv3
ivprobit gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection8  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first
estimates store iv4
ivprobit gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election5year = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first 
estimates store iv5
ivprobit gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection8  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first
estimates store iv6
ivprobit gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election5year = nbdictatorelection5year meandictatorelection5year), first 
estimates store iv7
ivprobit gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection8  = nbdictatorelection5year meandictatorelection5year), first
estimates store iv8
ivprobit gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election5year = nbdictatorelection5year meandictatorelection5year), first 
estimates store iv9
ivprobit gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection8  = nbdictatorelection5year meandictatorelection5year), first
estimates store iv10
estout iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10, cells(b(star fmt(%9.3f)) se(par fmt(%9.2f))) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N)style (tex)

***Test statistics for Tables A.20 and A.22
xi: xtivreg2 gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election5year = nbdictatorelection5year), fe first 
estimates store iv1
xi: xtivreg2 gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection8  = nbdictatorelection5year), fe first
estimates store iv2
xi: xtivreg2 gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election5year = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), fe first 
estimates store iv3
xi: xtivreg2 gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection8  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), fe first
estimates store iv4
xi: xtivreg2 gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election5year = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), fe first 
estimates store iv5
xi: xtivreg2 gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection8  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), fe first
estimates store iv6
xi: xtivreg2 gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election5year = nbdictatorelection5year meandictatorelection5year), fe first 
estimates store iv7
xi: xtivreg2 gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection8  = nbdictatorelection5year meandictatorelection5year), fe first
estimates store iv8
xi: xtivreg2 gwf_fail  election  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election5year = nbdictatorelection5year meandictatorelection5year), fe first 
estimates store iv9
xi: xtivreg2 gwf_fail  proxelection1 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection8  = nbdictatorelection5year meandictatorelection5year), fe first
estimates store iv10
estout iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10, cells(b(star fmt(%9.3f)) se(par fmt(%9.2f))) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N)style (tex)


******************
****Table A.23****
******************
xi: xtivreg2 gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election = nbmean_dictatorelection), fe first 
estimates store iv1
xi: xtivreg2 gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection1  = nbmean_dictatorelection), fe first
estimates store iv2
xi: xtivreg2 gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), fe first 
estimates store iv3
xi: xtivreg2 gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection1  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), fe first
estimates store iv4
xi: xtivreg2 gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), fe first 
estimates store iv5
xi: xtivreg2 gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection1  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), fe first
estimates store iv6
xi: xtivreg2 gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election = nbmean_dictatorelection globmeandictatorelection), fe first 
estimates store iv7
xi: xtivreg2 gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection1  = nbmean_dictatorelection globmeandictatorelection), fe first
estimates store iv8
xi: xtivreg2 gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election = nbmean_dictatorelection globmeandictatorelection), fe first 
estimates store iv9
xi: xtivreg2 gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection1  = nbmean_dictatorelection globmeandictatorelection), fe first
estimates store iv10
estout iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10, cells(b(star fmt(%9.3f)) se(par fmt(%9.2f))) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N)style (tex)


******************
****Table A.24****
******************
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3  (election = nbmean_dictatorelection), first 
estimates store iv1
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 (proxelection1  = nbmean_dictatorelection), first
estimates store iv2
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3  (election = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first 
estimates store iv3
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 (proxelection1  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first
estimates store iv4
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 nbfail_gwf_fail nbfail_gwf_fail5 (election = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection  nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first 
estimates store iv5
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 nbfail_gwf_fail nbfail_gwf_fail5 (proxelection1  = nbcount_election nbmax_election nbcount_dictatorship nbmean_dictatorelection nbdictatorelection5year globmeandictatorelection  meandictatorelection5year), first
estimates store iv6
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 (election = nbmean_dictatorelection globmeandictatorelection), first 
estimates store iv7
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 (proxelection1  = nbmean_dictatorelection globmeandictatorelection), first
estimates store iv8
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 nbfail_gwf_fail nbfail_gwf_fail5 (election = nbmean_dictatorelection globmeandictatorelection), first 
estimates store iv9
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3  nbfail_gwf_fail nbfail_gwf_fail5 (proxelection1  = nbmean_dictatorelection globmeandictatorelection), first
estimates store iv10
estout iv1 iv2 iv3 iv4 iv5 iv6 iv7 iv8 iv9 iv10, cells(b(star fmt(%9.3f)) se(par fmt(%9.2f))) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N)style (tex)


******************
****Table A.25****
******************
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election = nbmean_dictatorelection nbmax_election globmeandictatorelection), first 
estimates store iv7
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection1  = nbmean_dictatorelection nbmax_election globmeandictatorelection), first
estimates store iv8
ivprobit gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election = nbmean_dictatorelection nbmax_election globmeandictatorelection), first 
estimates store iv9
ivprobit gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection1  = nbmean_dictatorelection nbmax_election globmeandictatorelection), first
estimates store iv10
estout iv7 iv8 iv9 iv10, cells(b(star fmt(%9.3f)) se(par fmt(%9.2f))) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N)style (tex)

***Test statistics for A.25***
xi: xtivreg2 gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (election = nbmean_dictatorelection nbmax_election globmeandictatorelection), fe first 
estimates store iv7
xi: xtivreg2  gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade (proxelection1  = nbmean_dictatorelection nbmax_election globmeandictatorelection), fe first
estimates store iv8
xi: xtivreg2  gwf_fail  election5year  regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (election = nbmean_dictatorelection nbmax_election globmeandictatorelection), fe first 
estimates store iv9
xi: xtivreg2 gwf_fail  proxelection8 regiondem    loggdp  gdp_grow  cow_milsize  resdep2  duration  duration2  duration3 i.region i.decade nbfail_gwf_fail nbfail_gwf_fail5 (proxelection1  = nbmean_dictatorelection nbmax_election globmeandictatorelection), fe first
estimates store iv10
estout iv7 iv8 iv9 iv10, cells(b(star fmt(%9.3f)) se(par fmt(%9.2f))) starlevels (* 0.10 ** 0.05 *** 0.01) stats (N)style (tex)

